package com.geeke.sys.entity;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import com.geeke.common.persistence.DataEntity;
import com.geeke.org.entity.Company;
import com.geeke.org.entity.Department;
import java.util.Date;
import java.util.List;
import com.google.common.collect.Lists;

/**
 * 用户表Entity
 */
public class User extends DataEntity<User> {

    private static final long serialVersionUID = 1L;
    
    public User() {
        super();
    }
    
    public User(String id) {
        super(id);
    }

    @NotNull(message = "公司不能为空")
    private Company company = new Company(); // 公司
    public Company getCompany() {
        return company;
    }
    public void setCompany(Company company) {
        this.company = company;
    }

    @NotNull(message = "部门不能为空")
    private Department department = new Department(); // 部门
    public Department getDepartment() {
        return department;
    }
    public void setDepartment(Department department) {
        this.department = department;
    }

    @NotBlank(message = "名称不能为空")
    @Length(min = 1, max = 128, message = "名称长度必须介于1和128之间")
    private String name; // 名称
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

    @NotBlank(message = "登录账号不能为空")
    @Length(min = 1, max = 10, message = "登录账号长度必须介于1和10之间")
    private String loginName; // 登录账号
    public String getLoginName() {
        return loginName;
    }
    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    private String loginPassword; // 密码
    public String getLoginPassword() {
        return loginPassword;
    }
    public void setLoginPassword(String loginPassword) {
        this.loginPassword = loginPassword;
    }

    private boolean loginPasswordUpdate; // 是否修改 密码
    public boolean getLoginPasswordUpdate() {
        return loginPasswordUpdate;
    }

    public void setLoginPasswordUpdate(boolean loginPasswordUpdate) {
        this.loginPasswordUpdate = loginPasswordUpdate;
    }
	
    private String isLocked = "0"; // 禁用
    public String getIsLocked() {
        return isLocked;
    }
    public void setIsLocked(String isLocked) {
        this.isLocked = isLocked;
    }

    @NotBlank(message = "手机号不能为空")
    @Length(min = 1, max = 20, message = "手机号长度必须介于1和20之间")
    private String phone; // 手机号
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }

    @NotBlank(message = "邮箱地址不能为空")
    @Length(min = 1, max = 36, message = "邮箱地址长度必须介于1和36之间")
    private String email; // 邮箱地址
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }


    private String remarks; // 备注
    public String getRemarks() {
        return remarks;
    }
    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }
    private String isActive = "0"; // 已激活
    public String getIsActive() {
        return isActive;
    }
    public void setIsActive(String isActive) {
        this.isActive = isActive;
    }

    private Date changePwdDate; // 密码修改日期
    public Date getChangePwdDate() {
        return changePwdDate;
    }
    public void setChangePwdDate(Date changePwdDate) {
        this.changePwdDate = changePwdDate;
    }

    // 用户角色列表
    private List<UserRole> userRoleList = Lists.newArrayList();
    public List<UserRole> getUserRoleList() {
        return userRoleList;
    }
    public void setUserRoleList(List<UserRole> userRoleList) {
        this.userRoleList = userRoleList;
    }

    // 用户岗位列表
    private List<UserPost> userPostList = Lists.newArrayList();
    public List<UserPost> getUserPostList() {
        return userPostList;
    }
    public void setUserPostList(List<UserPost> userPostList) {
        this.userPostList = userPostList;
    }

    @Override
    public String getTableAlias() {
        return "user";
    }
} 